package com.nopay.dxdwphone.ui.adapter;

import android.graphics.Color;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.nopay.dxdwphone.bean.response.GetCallTaskCallResponse;

import java.util.List;

import com.nopay.dxdwphone.R;

/**
 * @ProjectName: guizhou_assets
 * @Package: dhc.guizhou.assets.view.adapter
 * @ClassName: TollAdapter
 * @Description: 外呼
 * @Author: Kawaii's cat
 * @CreateDate: 2020-6-2 11:13
 * @UpdateUser: 更新者：
 * @UpdateDate: 2020-6-2 11:13
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */
public class DialedAdapter extends BaseQuickAdapter<GetCallTaskCallResponse.Data, BaseViewHolder> {

    private static final String[] STATUS_NAME = {"未拨打", "已接通", "未接通", "空号/停机", "拒接", "开始拨号"};

    public DialedAdapter(@Nullable List<GetCallTaskCallResponse.Data> data) {
        super(R.layout.adapter_dialed, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, GetCallTaskCallResponse.Data bean) {
        helper.setText(R.id.tv_name, bean.getName())
                .setText(R.id.tv_tel_num, bean.getCalledNumber())
                .setText(R.id.tv_status, STATUS_NAME[bean.getStatus()])
                .setTextColor(R.id.tv_status, bean.getStatus() == 1 ? Color.parseColor("#999999") : Color.RED)
                .setText(R.id.tv_talk_time, bean.getDuration() + "秒")
                .setText(R.id.tv_call_data, bean.getCallDate());
    }

}